
public class Test {
    public static int sumEverySet(int n) {
        if(n <= 9) {
            return n;
        }
        return n % 10 + sumEverySet(n / 10);
    }
    public static void main(String[] args) {
        int n = 1234;
        int sum = sumEverySet(n);
        System.out.println(sum);
    }
    public static void printEverySet(int n) {
        if(n <= 9) {
            System.out.println(n);
            return;
        }
        printEverySet(n / 10);
        System.out.println(n % 10);
    }
    public static void main6(String[] args) {
        int n = 1234;
        printEverySet(n);
    }
    public static int fac(int n) {
        if(n == 1) {
            return 1;
        }else {
            return n * fac(n - 1);
        }
    }
    public static void main5(String[] args) {
        int n = 5;
        int fac = fac(n);
        System.out.println(fac);
    }
    public static void function(int n) {
        if(n == 1) {
            System.out.println(n);
            return;
        }
        function(n - 1);
        System.out.println(n);
    }
    public static void main4(String[] args) {
        int n = 10;
        function(n);
    }
    public static int fib(int n) {
        int f1 = 1;
        int f2 = 2;
        int f3 = 1;
        for (int i = 3; i <= n; i++) {
            f3 = f1 + f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }
    public static void main3(String[] args) {
        int n = 10;
        System.out.println(fib(n));
        }
    public static int max2(int a, int b) {
        if(a < b) {
            return b;
        } else {
            return a;
        }
    }
    public static int max3(int a, int b, int c) {
        return max2(max2(a, b), c);
    }
    public static void main2(String[] args) {
        int a = 10;
        int b = 11;
        int c = 12;
        int ret = max3(a, b, c);
        System.out.println(ret);
    }
    public static int sum(int a, int b) {
        return a + b;
    }
    public static double sum(double a, double b) {
        return a + b;
    }
    public static void main1(String[] args) {
        int a = 10;
        int b = 20;
        int ret = sum(a, b);
        System.out.println(ret);

        double c = 1.2;
        double d = 1.1;
        double ret2 = sum(c, d);
        System.out.println(ret2);
    }
}
